package cn.stylefeng.guns.modular.api.controller;

import cn.stylefeng.guns.modular.api.service.IArticleService;
import cn.stylefeng.roses.core.reqres.response.SuccessResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 新闻资讯控制器
 * @author gin
 * @Date 2019年1月18日 下午8:25:24
 */

@RestController
@RequestMapping("/article")
class ArticleController {

    @Autowired
    IArticleService articleService;


    /**
     * 文章列表
     */
    @GetMapping(value = "/")
    public Object list(int num) {
        return new SuccessResponseData(articleService.list(num));
    }

    /**
     * 文章详情
     */
    @GetMapping(value = "/{id}")
    public Object get(@PathVariable int id) {
        return new SuccessResponseData(articleService.get(id));
    }

}
